namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        OrderService service;
        Form2 CreateOrder;
        Form3 ModifyOrder;
        public Form1()
        {
            InitializeComponent();
            service = new OrderService();
            /*
            dataGridView1.DataSource = service;
            dataGridView1.DataMember = "data";
            */
            this.Load += new EventHandler(Form1_Load);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            bindingSource1.DataSource = service.data;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            CreateOrder = new Form2();
            CreateOrder.MyEvent += service.add;
            CreateOrder.ShowDialog();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ModifyOrder = new Form3();
            ModifyOrder.MyEvent2 += service.modify;
            ModifyOrder.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            service.del(Int32.Parse(textBox2.Text));
        }

        private void button6_Click(object sender, EventArgs e)
        {
            service.Export();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            service.Import();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.Text = service.search(comboBox1.SelectedIndex + 1, textBox3.Text);
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}